Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nop

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nop

library for providing a function that does nothing; it's like super useful

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3K
decreased by-25.25%
Maintainers
1
Weekly downloads
 
Created
Source

nop

a library for providing a javascript function that does nothing; it's like super useful

Build Status

endorse

use case

Did you know every time you create a do-nothing no-op function you're consuming memory? You can literally save maybe a whole byte or two by using this nop library.

Anybody who cares about being efficient and doesn't care about being rediculous should use this library.

examples

default callback

var nop = require('nop');

function example(options) {
  options = options || {};
  options.success = options.success || nop;
  options.error = options.error || nop;

  // do stuff
  options.success();
}

feel like calling a function, but don't want it to do anything and don't want to create it myself

var nop = require('nop');

var a = 'a';
var b = 'b';
// do you think I should call a function now?
var c = 'c';
// nah, I'll wait
var d = 'd';
var e = 'e';
var f = 'f';
// maybe now
nop();
var g = 'g';
// can I do another?
var h = 'h';
var j = 'j';
// sure... I guess
nop();
nop();
// hey, you were supposed to just do one
var i = 'i';
// sorry
var j = 'j';
// alright, then, as long as you're sorry
var k = 'ok';

Keywords

FAQs

Package last updated on 23 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc